package com.stox.ui.javafx.core.widget;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.stox.ui.javafx.core.event.handler.ExitEventHandler;
import com.stox.ui.javafx.core.util.MessageSource;
import com.stox.ui.javafx.core.widget.wrapper.MenuItem;

@Component
public class ExitMenuItem extends MenuItem implements InitializingBean {

	@Autowired
	private ExitEventHandler exitEventHandler;
	
	public ExitMenuItem() {
		super(MessageSource.getMessage("Exit"), "Alt+F4", "exit.png");
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		setOnAction(exitEventHandler);
	}
	
	@Override
	public int getOrder() {
		return Integer.MAX_VALUE;
	}

	@Override
	public Class<?> getParentClass() {
		return FileMenu.class;
	}

}
